local AceGUI = LibStub('AceGUI-3.0')

local frame = AceGUI:Create("Frame") -- 创建框架
frame:SetTitle("Layer") -- 设置框架标题
frame:SetStatusText("位面插件") -- 设置框架状态栏文字
frame:SetCallback("OnClose", function(widget) AceGUI:Release(widget) end) --设置调用
frame:SetLayout("Flow") -- 设置布局
frame:SetWidth(858)
frame:SetHeight(660)
frame.frame:SetMinResize(600, 500)
-- frame:Hide()


local textStore -- 声明一个值


local CheckBox = AceGUI:Create("CheckBox") -- 创建按钮
CheckBox:SetLabel("勾选")
CheckBox:SetWidth(100)
frame:AddChild(CheckBox)
CheckBox:SetCallback("OnValueChanged", function(value)
    print(value)
end)


local editbox = AceGUI:Create("EditBox") -- 创建输入框
editbox:SetLabel("输入内容:") -- 设置输入框标签
editbox:SetWidth(200) -- 设置输入框宽度
editbox:SetCallback("OnEnterPressed", function(widget, event, text) 
    textStore = text
end)
frame:AddChild(editbox) -- 把输入框这个挂件挂到框架上

local button = AceGUI:Create("Button") -- 创建按钮
button:SetText("点击!") -- 设置按钮显示文字
button:SetWidth(100)
button:SetCallback("OnClick", function()
     print(textStore)
end)
frame:AddChild(button)


local fonts = LibStub("LibSharedMedia-3.0"):List("font")
local dropdown = AceGUI:Create("Dropdown")
dropdown:SetLabel("Font")
dropdown:SetList(fonts, nil)
dropdown:SetCallback("OnValueChanged", function(_, _, value)
    self:Print(value)
end)

for i, v in next, fonts do
    dropdown:SetValue(i)
end




local AceAddon = LibStub('AceAddon-3.0'):NewAddon("Layer", "AceConsole-3.0", "AceEvent-3.0")

-- 初始化 插件加载 执行一次
function AceAddon:OnInitialize()
    -- Called when the addon is loaded
    self:Print("插件加载!")
    UIErrorsFrame:AddMessage("插件加载", 1.0, 1.0, 1.0, 5.0)
end


function AceAddon:OnEnable()
    -- self:RegisterEvent("ZONE_CHANGED")
    self:Print("Hello World!")
end


function AceAddon:OnDisable()
    -- Called when the addon is disabled
end